﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WeatherPush
{
    abstract class Data
    {
        protected List<Device> devices = new List<Device>();

        public void RegisterDevice(Device device)
        {
            devices.Add(device);
        }

        public void RemoveDevice(int index)
        {
            if (index >= 0 && index < devices.Count)
            {
                devices.RemoveAt(index);
            }
        }

        public void NotifyDevices()
        {
            foreach (var device in devices)
            {
                device.Update(this);
            }
        }
    }
}
